@extends('layouts.admin')
@section('pageTitle', '奖品列表')
@section('content')
    @component('components.web.sidemenu')@endcomponent
    <div class="main-panel">
        <div class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-12">
                        <div class="card ">
                            <div class="header">
                                <div class="btn-group" role="group">
                                    <button type="button" class="btn btn-default">自建奖品</button>
                                    <button type="button" class="btn btn-default">红包奖品</button>
                                </div>
                                <form class="btn-group" role="search" style="width: 400px" method="get">
                                    <div class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                                        <input type="text" value="" class="form-control" placeholder="Search..."
                                               name="name">
                                    </div>
                                </form>
                                <div class="btn-group" role="group" style="float: right!important;">
                                    <a type="button" class="btn btn-default" href="/web/prize/create">新建奖品</a>
                                </div>
                            </div>
                            <div class="content">
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="table-responsive">
                                            <table class="table">
                                                <thead>
                                                <tr>
                                                    <th>奖品名称</th>
                                                    <th>奖品类型</th>
                                                    <th>有效期</th>
                                                    <th>奖品资源状态</th>
                                                    <th>库存</th>
                                                    <th>被抽中</th>
                                                    <th>被锁定</th>
                                                    <th>当前可用库存</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                @forelse($prizes as $prize)
                                                    <tr>
                                                        <td>{{$prize['name']}}</td>
                                                        <td>{{$prize['type_code']}}</td>
                                                        <td>
                                                            <div>{{$prize['expired_start']}}</div>
                                                            <div>{{$prize['expired_end']}}</div>
                                                        </td>
                                                        @if($prize['expired_end']>date('Y-m-d H:i:s'))
                                                            <td>可使用</td>
                                                        @else
                                                            <td>已过期</td>
                                                        @endif
                                                        <td>{{$prize['stock_number']}}</td>
                                                        <td>{{$prize['recordNumber'].'/'.$prize['recordAmount']}}</td>
                                                        <td>{{$prize['activityNumber'].'/'.$prize['activityAmount']}}</td>
                                                        <td>{{$prize['stock_number']-$prize['activityNumber']}}</td>
                                                        <td>
                                                            <div class="btn-group">
                                                                <div>入库</div>
                                                                <div>详情</div>
                                                                <div class="dropdown">
                                                                    <a href="#" class="dropdown-toggle"
                                                                       data-toggle="dropdown">
                                                                        更多
                                                                        <span class="caret"></span>
                                                                    </a>
                                                                    <ul class="dropdown-menu dropdown-menu-right">
                                                                        <li><a href="#">出库</a></li>
                                                                        <li><a href="#">编辑</a></li>
                                                                        <li><a href="#">删除</a></li>
                                                                    </ul>
                                                                </div>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                @empty
                                                    <tr>
                                                        <td colspan="9">暂时没有数据</td>
                                                    </tr>
                                                @endforelse
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    @component('components.web.setting')@endcomponent
@endsection
@section('style')
    <style>
        .dropdown-menu:before, .dropdown-menu:after {
            display: none;
        }
    </style>
@endsection()
